Skip to content

fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249

Closed
GokhanKabar wants to merge 2 commits intomicrosoft:mainfrom
GokhanKabar:fix/isolatedModules-affectsEmit
Closed

fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249
GokhanKabar wants to merge 2 commits intomicrosoft:mainfrom
GokhanKabar:fix/isolatedModules-affectsEmit

Conversation

@GokhanKabar
Copy link

Fixes #63223

Problem

Toggling isolatedModules in tsconfig.json while running tsc --watch did not trigger re-emission of files containing const enum declarations. A fresh compilation produced the correct output, but watch mode left stale JS files.

Root cause

The isolatedModules option declaration in commandLineParser.ts was missing affectsEmit: true, affectsBuildInfo: true, and affectsSemanticDiagnostics: true.

As a result, compilerOptionsAffectEmit() returned false when only isolatedModules changed, so the builder never marked files as pending re-emit.

isolatedModules directly affects const-enum emit: when enabled, tryGetConstEnumValue in transformers/ts.ts always returns undefined, preventing value inlining; when disabled, values are inlined. The closely related
verbatimModuleSyntax and preserveConstEnums options already carry these flags — this aligns isolatedModules with them.

…solatedModules option

Toggling `isolatedModules` in `tsconfig.json` while in watch mode did not
trigger re-emission of files containing `const enum` declarations. A fresh
compilation produced the correct output, but watch mode left stale JS files.

Root cause: the `isolatedModules` option declaration in `commandLineParser.ts`
was missing `affectsEmit: true`, `affectsBuildInfo: true`, and
`affectsSemanticDiagnostics: true`. As a result, `compilerOptionsAffectEmit()`
returned `false` when only `isolatedModules` changed, so the builder never
marked files as pending re-emit.

`isolatedModules` directly affects const-enum emit: when enabled,
`tryGetConstEnumValue` (transformers/ts.ts) always returns `undefined`,
preventing inlining; when disabled, values are inlined. The option already
had these flags on the closely related `verbatimModuleSyntax` and
`preserveConstEnums` options — this aligns `isolatedModules` with them.

Fixes microsoft#63223
@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

@GokhanKabar GokhanKabar deleted the fix/isolatedModules-affectsEmit branch March 24, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

2 participants